﻿#ifndef XCOIL_H
#define XCOIL_H

#include <QObject>
#include "xnamespace.h"

QT_BEGIN_NAMESPACE

using namespace xvs;

class XCoilPrivate;
class XCoil : public QObject
{
    Q_OBJECT

    Q_PROPERTY(DeviceType deviceType READ getDeviceType WRITE setDeviceType NOTIFY deviceTypeChanged)
    Q_PROPERTY(int deviceNumber READ getDeviceNumber WRITE setDeviceNumber NOTIFY deviceNumberChanged)
    Q_PROPERTY(CoilObjectType objectType READ getObjectType WRITE setObjectType NOTIFY objectTypeChanged)
    Q_PROPERTY(int objectNumber READ getObjectNumber WRITE setObjectNumber NOTIFY objectNumberChanged)
    Q_PROPERTY(bool coilValue READ getCoilValue WRITE setCoilValue NOTIFY coilValueChanged)

public:
    explicit XCoil(QObject *parent = nullptr);
    ~XCoil();

    /* Property Interface */
    DeviceType getDeviceType() const;
    void setDeviceType(DeviceType);

    int getDeviceNumber() const;
    void setDeviceNumber(int);

    CoilObjectType getObjectType() const;
    void setObjectType(CoilObjectType);

    int getObjectNumber() const;
    void setObjectNumber(int);

    bool getCoilValue() const;
    void setCoilValue(bool);

signals:
    void deviceTypeChanged(DeviceType);
    void deviceNumberChanged(int);
    void objectTypeChanged(CoilObjectType);
    void objectNumberChanged(int);
    void coilValueChanged(bool);

private:
    Q_DISABLE_COPY(XCoil)
    XCoilPrivate *xCoilP = nullptr;
};

QT_END_NAMESPACE

#endif // XCOIL_H
